﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using AiFrame.Base.Core.Data.Access;
using AiFrame.Base.WinUI;
using AiFrame.Base.WinUI.Windows.UI;
using AiFrameDemo.Core;

namespace AiFrameDemo.App.WinUI
{
    static class Program
    {
        /// <summary>
        /// Der Haupteinstiegspunkt für die Anwendung.
        /// </summary>
        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            try
            {
                BaseInitialization baseInitialization = new BaseInitialization(args);
                baseInitialization.PreInitialize();

                // Create connection to database
                CoreInitialization.Initialize();

                baseInitialization.PostInitialize(new DefaultStartupView());
            }
            catch (DatabaseConnectionException dbe)
            {
                MessageBox.Show("Error while connecting to the database: " + dbe.InnerException.Message);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }

            
            //Application.Run(new Form1());
        }
    }
}
